package io.github.chutian0610.sqlparser.token

import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.shouldBe

class UnescapeTest : StringSpec({
    "Unescape charFromU32() should return correct char" {
        Unescape.charFromU32(0x0041u) shouldBe CodePoint.fromInt('A'.code)
        Unescape.charFromU32(0x4F60u) shouldBe CodePoint.fromInt('你'.code)
        Unescape.charFromU32(0x1F49Du) shouldBe CodePoint.fromString("💝")
        Unescape.charFromU32(0xD800u) shouldBe null
        Unescape.charFromU32(0x00A9u) shouldBe CodePoint.fromChar('©')
        Unescape.charFromU32(0x1F680u) shouldBe CodePoint.fromString("🚀")
        Unescape.charFromU32(0xDFFFu) shouldBe null
        Unescape.charFromU32(0x110000u) shouldBe null
    }
})
